<template>
	<div>
		<div class="calendar-content">
			<el-date-picker
		      v-model="value2"
		      align="left"
		      type="date"
		      :picker-options="pickerOptions1"
		      @change="dateValue">
		    </el-date-picker>
		</div>
	</div>
</template>

<script>
	import $ from 'jquery'
 export default {
 	mounted () {
 		var $con = $(".calendar-content")
   	    $con.find("input").attr("readonly","readonly")
 	},
    data() {
      return {
        pickerOptions1: {
          disabledDate(time) {
            return time.getTime() > Date.now();
          },
          shortcuts: [{
            text: '重置',
            onClick(picker) {
              picker.$emit('pick', null);
            }
          }, {
            text: '昨天',
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24);
              picker.$emit('pick', date);
            }
          }, {
            text: '一周前',
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit('pick', date);
            }
          }]
        },
        value1: '',
        value2: '',
      };
    },
    methods: {
    	dateValue (val) {
    		this.$emit('calDate',val)
//  		if (isEmpty) {
//				that.value2 = ''
//			} else {
//				that.value2 = val
//			}
        }
    
    },
    
  };

</script>

<style scoped>
	@import '../../../static/components/public/calendar.css'
	.el-input__prefix {
	left: 100px !important;
	width: 160px !important;
}
</style>